package Reflect;

import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;

public class ReflectDemo3 {
    public static void main(String[] args) throws Exception{
        Class cla=Class.forName("Reflect.Person");
        Constructor c=cla.getConstructor(String.class);
        Object obj=c.newInstance("张三");
        System.out.println(obj);

        Constructor c1=cla.getConstructor(String.class,int.class);
        Object obj1=c1.newInstance("李四",20);
        System.out.println(obj1);
    }
}
